package com.apps.gomdiem.helper;

import java.util.ArrayList;

import com.apps.gomdiem.adapter.GridAdapter;
import com.apps.gomdiem.fragment.HomeTabFragment;
import com.apps.gomdiem.hardcode.MyHardCode;
import com.apps.gomdiem.model.ListenerClass;
import com.apps.gomdiem.model.Store;

import android.database.CursorJoiner.Result;
import android.os.AsyncTask;
import android.support.v4.app.FragmentActivity;
import android.util.Log;

public class HomeAsyncTask extends AsyncTask<Integer, Object, ArrayList<Store>>{
	
	private ListenerClass mListener;
	public HomeAsyncTask(ListenerClass pListener){
		this.mListener=pListener;
	}
	@Override
	protected ArrayList<Store> doInBackground(Integer... params) {
		int temp= params[0];
		ArrayList<Store> myArray = new ArrayList<Store>() ;
		if(temp ==0){
			myArray = MyHardCode.getYeuThich();
		}
		if(temp==1){
			myArray = MyHardCode.getMuaNhieu();
		}
		if(temp==2){
			myArray = MyHardCode.getMoiNhat();
			
		}
		
		return myArray;
		
	}
	@Override
	protected void onPostExecute(ArrayList<Store> result) {
		// TODO Auto-generated method stub
		super.onPostExecute(result);
		mListener.doArraylistStoreHorizonal(result);
	}
	
	
	
}
